package com.cn.algorithm02.class04;

import com.cn.algorithm02.class01.CodeUtil;

import java.util.Stack;

/***
 * @author: hels
 * @description: 使用递归获取最大值
 **/
public class C07_RecursionMax {
    public static void main(String[] args) {
        int[] ints = CodeUtil.generatorArray();
        int max = process(ints, 0, ints.length - 1);
        System.out.println(max);

    }

    public static int process(int[] arr, int L, int R) {
        if(L == R) return arr[L];

        int mid = L +((R - L)>>1);
        int left = process(arr, L, mid);
        int right = process(arr, mid+1, R);
        return Math.max(left, right);
    }
}
